package edu.llg.cli.command;


import edu.llg.generate.MainGenerator;
import edu.llg.model.MainTemplateConfig;
import picocli.CommandLine;
import picocli.CommandLine.Option;
import picocli.CommandLine.Command;

import java.util.concurrent.Callable;

/**
 * @author 隆利果
 * @version 1.0
 * @date 2024/2/23 14:14
 */
@Command(name = "generator", mixinStandardHelpOptions = true,description = {"生成代码"})
public class GenerateCommand implements Callable<Integer> {

    /**
     * names：选项名称
     * description：描述
     * arity：0..1  选项后面可接可不接参数，例如，【-l true】,【-l】
     * interactive：是否启用交互式
     * echo：是否隐藏输入值，默认为隐藏
     */
    @Option(names = { "-l", "--loop" }, description = "是否循环",arity = "0..1",interactive = true,echo = true)
    private boolean loop;

    @Option(names = { "-a", "--author" }, description = "作者",arity = "0..1",interactive = true,echo = true)
    private String author;

    @Option(names = { "-o", "--outputText" }, description = "输出信息",arity = "0..1",interactive = true,echo = true)
    private String outputText;

    @Override
    public Integer call() throws Exception {
        MainTemplateConfig mainTemplateConfig = new MainTemplateConfig();
        mainTemplateConfig.setLoop(loop);
        mainTemplateConfig.setAuthor(author);
        mainTemplateConfig.setOutputText(outputText);
        MainGenerator.doGenerate(mainTemplateConfig);
        return 0;
    }

    /**
     * paramLabel：参数标签，类似描述信息
      * defaultValue：默认值
     */


}
